package com.baizhi.service.Impl;

import com.baizhi.dao.UserDao;
import com.baizhi.entity.User;
import com.baizhi.service.UserService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao ud;
    @Override
    public boolean login(String user,String pwd) {
        QueryWrapper qw = new QueryWrapper();
        qw.eq("username", user);
        qw.eq("password", pwd);
        User user1 = ud.selectOne(qw);
        if (user1 == null) {
            return false;
        }
            return true;
    }

    @Override
    public User selectByUser(String name, String pwd) {
        QueryWrapper qw = new QueryWrapper();
        qw.eq("username", name);
        qw.eq("password", pwd);
        return  ud.selectOne(qw);
    }
}
